from django_redis import get_redis_connection

class MyRedis:
    def __init__(self):
        self.conn = get_redis_connection("default")
    def set(self,key,value,ex):
        self.conn.setex(key,ex,value)

    def get(self,key):
        value = self.conn.get(key)
        if value:
            return value.decode('utf-8')
        else:
            return None


myRedis = MyRedis()
